add a stopwatch around cropping pngquanting#4471
Merged
Merged
Conversation
391efd7 to
f9c529c
Compare
2cbcd4e to
a0394b7
Compare
We don't care about filesize for master, as it'll be sent to fastly to be resized. We also don't care about non-master, as they'll be run through `pngquant` immediately after this, so any compression will be immediately undone.
bryophyta
approved these changes
Jun 12, 2025
bryophyta
left a comment
Contributor
There was a problem hiding this comment.
code lgtm and I tested cropping a png on TEST as well 👍👍
|
Seen on auth, usage, image-loader, metadata-editor, thrall, leases, cropper, collections, media-api, kahuna (merged by @andrew-nowak 8 minutes and 41 seconds ago) Please check your changes! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We've had some complaints that some (pretty big & complex) pngs are being very slow to crop - eagle eyes @paperboyo noticed that we're setting output crop quality to 95 (and 75 for non-master crops), but the "quality" param have slightly different meaning for PNGs. Since they're lossless by default, lowering the quality doesn't lower the quality of the output, only the time/effort spent compressing the files. On our testing locally, this lowered the time taken to create a troublesome master crop from 30s to <1s.
While troubleshooting, I added a few new Stopwatch invocations, and created a new
asyncvariant to better track the duration of executing futures, and we also increased thepngquantspeed for crops from 8 to 10 - this is the same as for image loading, and shaves a couple of extra seconds off the duration.All told this particular image still takes 18s to crop, but this is still a marked improvement we can deliver